<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //function fh(){
        //let num1 = +prompt('请输入一个数')
        //let num2 = +prompt('请输入另一个数')
        //let max
        //return num1 >num2? num1:num2 
        //}
        //console.log(fh())


        // function fn(arr = []){
        //     let max = arr[0]
        //     for(let i =0;i<arr.length;i++){
        //         if(max <arr[i]){
        //             max =arr[i]
        //         }
        //     }
        //     return max
        // }
        // console.log(fn([1, 2, 3, 4, 5, 6]))

        function fn(arr=[]){
            let min =arr[0]
            for(let i = 0;i<arr.length;i++){
                min = min >arr[i] ? arr[i] :min
            }
            return min
        }
        console.log(fn([1, 2, 3, 4, 5]))
    </script>
</body>
</html>